/**
 * Created by Administrator on 2017/1/11.
 */
/**
 * Created by Administrator on 2017/1/10.
 */

import {Injectable} from "@angular/core";
import {Observable} from "rxjs/Observable";
import {Http,URLSearchParams} from "@angular/http";

import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
@Injectable()
export class SecondService {
  constructor(private http:Http){

  }

  getGameData(){
    var url = "http://localhost:9000/h5/game";
    return this.http.get(url).map(res=>res.json());
  }
  getInfoData(type) {
    console.log("type=",type);
    let params = new URLSearchParams();
    params.set("type",type);
    var iurl =  "http://localhost:9000/h5/game";
    return this.http.get(iurl,{method:"get",search:params}).map(res=>res.json());
  }

  //guess tab..
  getGuessData(type) {
    console.log("guess type=",type);
    let params = new URLSearchParams();
    params.set("selectType",type);
    var guessUrl = "http://localhost:9000/h5/guess";
    return this.http.get(guessUrl,{method:"get",search:params}).map(res=>res.json());
  }
}
